package com.example.demo.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Serve {
    private String serveTheme;
    private String serveLinkman;
    private String servePhone;
    private Timestamp serveRegisterDate;
    private Timestamp serveStatrDate;
    private Timestamp serveEndDate;
    private String serveSpendDate;
    private String serveState;
    private String serveContent;
    private String serveFeedback;
    private String serveComment;
    private Client kh;
    private User zxr;
    private Servetype fwlx;
    private Serveway fwfs;


    @Id
    @Column(name = "serve_theme", nullable = false, length = 255)
    public String getServeTheme() {
        return serveTheme;
    }

    public void setServeTheme(String serveTheme) {
        this.serveTheme = serveTheme;
    }

    @Basic
    @Column(name = "serve_linkman", nullable = false, length = 20)
    public String getServeLinkman() {
        return serveLinkman;
    }

    public void setServeLinkman(String serveLinkman) {
        this.serveLinkman = serveLinkman;
    }

    @Basic
    @Column(name = "serve_phone", nullable = false, length = 20)
    public String getServePhone() {
        return servePhone;
    }

    public void setServePhone(String servePhone) {
        this.servePhone = servePhone;
    }

    @Basic
    @Column(name = "serve_registerDate", nullable = false)
    public Timestamp getServeRegisterDate() {
        return serveRegisterDate;
    }

    public void setServeRegisterDate(Timestamp serveRegisterDate) {
        this.serveRegisterDate = serveRegisterDate;
    }

    @Basic
    @Column(name = "serve_statrDate", nullable = false)
    public Timestamp getServeStatrDate() {
        return serveStatrDate;
    }

    public void setServeStatrDate(Timestamp serveStatrDate) {
        this.serveStatrDate = serveStatrDate;
    }

    @Basic
    @Column(name = "serve_endDate", nullable = false)
    public Timestamp getServeEndDate() {
        return serveEndDate;
    }

    public void setServeEndDate(Timestamp serveEndDate) {
        this.serveEndDate = serveEndDate;
    }

    @Basic
    @Column(name = "serve_spendDate", nullable = false, length = 20)
    public String getServeSpendDate() {
        return serveSpendDate;
    }

    public void setServeSpendDate(String serveSpendDate) {
        this.serveSpendDate = serveSpendDate;
    }

    @Basic
    @Column(name = "serve_state", nullable = false, length = 20)
    public String getServeState() {
        return serveState;
    }

    public void setServeState(String serveState) {
        this.serveState = serveState;
    }

    @Basic
    @Column(name = "serve_content", nullable = false, length = 255)
    public String getServeContent() {
        return serveContent;
    }

    public void setServeContent(String serveContent) {
        this.serveContent = serveContent;
    }

    @Basic
    @Column(name = "serve_feedback", nullable = true, length = 255)
    public String getServeFeedback() {
        return serveFeedback;
    }

    public void setServeFeedback(String serveFeedback) {
        this.serveFeedback = serveFeedback;
    }

    @Basic
    @Column(name = "serve_comment", nullable = true, length = 255)
    public String getServeComment() {
        return serveComment;
    }

    public void setServeComment(String serveComment) {
        this.serveComment = serveComment;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Serve serve = (Serve) o;
        return Objects.equals(serveTheme, serve.serveTheme) &&
                Objects.equals(serveLinkman, serve.serveLinkman) &&
                Objects.equals(servePhone, serve.servePhone) &&
                Objects.equals(serveRegisterDate, serve.serveRegisterDate) &&
                Objects.equals(serveStatrDate, serve.serveStatrDate) &&
                Objects.equals(serveEndDate, serve.serveEndDate) &&
                Objects.equals(serveSpendDate, serve.serveSpendDate) &&
                Objects.equals(serveState, serve.serveState) &&
                Objects.equals(serveContent, serve.serveContent) &&
                Objects.equals(serveFeedback, serve.serveFeedback) &&
                Objects.equals(serveComment, serve.serveComment);
    }

    @Override
    public int hashCode() {
        return Objects.hash(serveTheme, serveLinkman, servePhone, serveRegisterDate, serveStatrDate, serveEndDate, serveSpendDate, serveState, serveContent, serveFeedback, serveComment);
    }

    @ManyToOne
    @JoinColumn(name = "serve_clientID", referencedColumnName = "client_id", nullable = false)
    public Client getKh() {
        return kh;
    }

    public void setKh(Client kh) {
        this.kh = kh;
    }

    @ManyToOne
    @JoinColumn(name = "serve_doPeopleID", referencedColumnName = "uid", nullable = false)
    public User getZxr() {
        return zxr;
    }

    public void setZxr(User zxr) {
        this.zxr = zxr;
    }

    @ManyToOne
    @JoinColumn(name = "serve_typeID", referencedColumnName = "st_ID", nullable = false)
    public Servetype getFwlx() {
        return fwlx;
    }

    public void setFwlx(Servetype fwlx) {
        this.fwlx = fwlx;
    }

    @ManyToOne
    @JoinColumn(name = "serve_wayID", referencedColumnName = "sw_ID", nullable = false)
    public Serveway getFwfs() {
        return fwfs;
    }

    public void setFwfs(Serveway fwfs) {
        this.fwfs = fwfs;
    }
}
